<%@ page contentType="text/html; charset=utf-8" language="java" import="java.util.*" errorPage="" %> 
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>地址管理</title>
	<meta http-equiv="pragma" content="no-cache"/>
	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0"/>    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
	<meta http-equiv="description" content="This is my page"/>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="/css/pager.css" type="text/css"></link>
	<script type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="/js/pageView.js"></script> 
	<link href="/css/houseManage.css" rel="stylesheet" type="text/css" />
		<script src="js/formValidator-4.1.0.js" type="text/javascript" charset="UTF-8"></script>
<script src="js/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
	<script type="text/javascript">
	$(document).ready(function() {
		  		$.formValidator.initConfig({formID:"actForm",debug:false,submitOnce:true,
				onError:function(msg,obj,errorlist){
					$("#errorlist").empty();
					$.map(errorlist,function(msg){
						$("#errorlist").append("<li>" + msg + "</li>")
					});
					alert(msg);
				},
				submitAfterAjaxPrompt : '有数据正在异步验证，请稍等...',
				onShowClass : "",
				onFocusClass : "",
				onCorrectClass : ""
			});
			$("#type").formValidator({onShow:"用户名至少5个字符,最多10个字符",onFocus:"昵称至少2个汉字或4个字符，最多5个汉字或10个字符",onCorrect:"该用户名可以注册"}).inputValidator({min:1,max:10,onError:"地址至少1个字符，最多10个字符"})
			.ajaxValidator({
	dataType : "text",
	async : true,
	url : "/adress.do?method=findTypeIs",
	success : function(data){
		if(data==1){
			return false;
		}
		if(data==0){
			return true;
		}
			return true;
	}, 
	error: function(jqXHR, textStatus, errorThrown){alert("服务器没有返回数据，可能服务器忙，请重试"+errorThrown);},
	onError : "该分类名称已存在，请更换名称",
	onWait : "正在对分类名称进行合法性校验，请稍候..."
});
	  	});
	function del(id){
		$.post("/adress.do?method=deleteClothingType&id="+id,function(text){
        if(text==1){
						question = confirm("是否确定要删除该条信息?")
						if (question != "0"){					 	
  						window.location.href="/adress.do?method=deleteOneClothingType&id="+id;
  						}
						}else{
						question = confirm(text)
						if (question != "0"){					 	
  						window.location.href="/adress.do?method=deleteAllClothingType&id="+id;
  						}
						}
        
        });
	}
			function pageNoId(pageNo){	
			 window.location.href="/adress.do?method=viewAdress&pageNo="+pageNo
			}		
	</script>
  </head>
  
  <body>
   您当前的位置：地址管理
  <div style="margin-left: auto;margin-right: auto;width: 700px;">
     <form action="/adress.do?method=addAdress" method="post" id="actForm" enctype="multipart/form-data"> 
        省/直辖市名称：
	    	<select id="cid" name="cid">
	    		<option value="0">省/直辖市名称</option>
	    	    <c:forEach items="${list}" var="list">
	    			<option value="${list.id}">${list.adressName}</option>
	    	    </c:forEach>
	    	</select>      
        城市名称：<input type="text" id="type" name="type"/>
    <input type="submit" value="添加"/>
    </form>
     <div class="cao_gaojisousuo_rw2" style="width:510px;">
		<div class="cao_gaojisousuo_axmcz02"style="width:510px;">
			<h4>ID</h4>
			<h3>父类名称 </h3>
			<h3>子分类名称 </h3>
			<h1>操作  </h1>
			<div style="clear:both;"></div>
		</div>
	 <c:forEach items="${pager.resultList}" var="u" >
				<div class="cao_gaojisousuo_nr">
					<h4 style="height: 35px;">
						${u.id}
					</h4>
					<h3 style="height: 35px;">
						${u.fname}
					</h3>
					<h3 style="height: 35px;">
						${u.zname}
					</h3>					
					<h2 style="height: 35px;">
						<span><a href="/adress.do?method=toUpdateClothingType&id=${u.id}">修改</a></span>
						<span><a href="javascript:del(${u.id})">删除</a></span>
					</h2>		
					
					<div style="clear: both;"></div>
				</div>
				</c:forEach>
            <!-- 任务 列表  div  结束 -->
            </div>
       </div>   
          <div id="pager" style="width: 500px; float:left;margin:0px auto 20px 270px;">
			<script type="text/javascript">
		            var pager = new PagerView('pager');
		            //共计多少条信息
		            pager.itemCount = ${pager.rowCount};
					//共计多少页
					pager.pageCount=${pager.pageCount};
					//每页显示记录数
					pager.size =${pager.pageSize};
					//当前页码, 从1开始
					pager.index =${pager.pageNo} ;
					//alert(pager.index);
					pager.render();
				</script>
				</div>
  </body>
</html>
